/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.fsq.portscan;

import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

import java.net.URL;

/**
 * jdk 18
 * @author fsq
 */
public class XmfPortScan extends Application {

	@Override
	public void start(Stage stage) throws Exception {

		String javaVersion = System.getProperty("java.version");
		String javafxVersion = System.getProperty("javafx.version");

		System.out.println("java version:"+javaVersion);
		System.out.println("javafx version:"+javafxVersion);

		URL location = getClass().getResource("/FXMLDocument.fxml");
		Parent root = FXMLLoader.load(location);

		stage.setTitle("小米范 portscan 3.2");

		stage.getIcons().add(new Image(this.getClass().getResourceAsStream("/icon.jpg")));

		Scene scene = new Scene(root);

		stage.setScene(scene);
		stage.show();

		stage.setOnCloseRequest(new EventHandler<WindowEvent>() {

			@Override
			public void handle(WindowEvent event) {

				try {
					// DbUtils.dispose();
					// DbUtils.stopDB();
					System.out.println("exit");
				} finally {
					// Platform.exit();
					System.exit(0);
				}
			}
		});
	}

	/**
	 * @param args
	 * the command line arguments
	 */
	public static void main(String[] args) {
		launch(args);
	}

}
